package com.surfacing.rcp.client.editors;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

public class CreateWindow extends ViewPart {
	public CreateWindow() {
	}
	public static final String ID = "com.surfacing.rcp.ui.views.CreateView";

	private TableViewer viewer;

	/**
	 * The content provider class is responsible for providing objects to the
	 * view. It can wrap existing objects in adapters or simply return objects
	 * as-is. These objects may be sensitive to the current input of the view,
	 * or ignore it and always show the same content (like Task List, for
	 * example).
	 */
	class ViewContentProvider implements IStructuredContentProvider {
		public void inputChanged(Viewer v, Object oldInput, Object newInput) {
		}

		public void dispose() {
		}

		public Object[] getElements(Object parent) {
			if (parent instanceof Object[]) {
				return (Object[]) parent;
			}
	        return new Object[0];
		}
	}

	class ViewLabelProvider extends LabelProvider implements
			ITableLabelProvider {
		public String getColumnText(Object obj, int index) {
			return getText(obj);
		}

		public Image getColumnImage(Object obj, int index) {
			return getImage(obj);
		}

		public Image getImage(Object obj) {
			return PlatformUI.getWorkbench().getSharedImages().getImage(
					ISharedImages.IMG_OBJ_ELEMENT);
		}
	}

	private Text txtFirstName;
	private Text txtLastName;
	private Text txtProtNr;
	private Text txtTransNr;
	private Text txtEinsatzort;
	private Text inputKilometer;
	private Text inputDiagnose;
	private Text inputBemerkung;


	/**
	 * Create contents of the view part.
	 * @param parent
	 */
	@Override
	public void createPartControl(Composite parent) {
		Composite container = new Composite(parent, SWT.NONE);
		container.setLayout(new GridLayout(10, false));
		new Label(container, SWT.NONE);
		{
			Label lblProtokollnummer = new Label(container, SWT.NONE);
			lblProtokollnummer.setText("Protokollnummer");
		}
		new Label(container, SWT.NONE);
		{
			txtProtNr = new Text(container, SWT.BORDER);
			txtProtNr.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		}
		new Label(container, SWT.NONE);
		{
			Label lblTransportnummer = new Label(container, SWT.NONE);
			lblTransportnummer.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
			lblTransportnummer.setText("Transportnummer");
		}
		{
			txtTransNr = new Text(container, SWT.BORDER);
			txtTransNr.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		}
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		{
			Label lblFirstName = new Label(container, SWT.NONE);
			lblFirstName.setText("Vorname");
		}
		new Label(container, SWT.NONE);
		{
			txtFirstName = new Text(container, SWT.BORDER);
			txtFirstName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		}
		new Label(container, SWT.NONE);
		{
			Label lblLastName = new Label(container, SWT.NONE);
			lblLastName.setText("Nachname");
		}
		{
			txtLastName = new Text(container, SWT.BORDER);
			txtLastName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		}
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		{
			Label lblEinsatzdatum = new Label(container, SWT.NONE);
			lblEinsatzdatum.setText("Einsatzdatum");
		}
		new Label(container, SWT.NONE);
		{
			DateTime dob = new DateTime(container, SWT.BORDER | SWT.DROP_DOWN);
		}
		new Label(container, SWT.NONE);
		{
			Label lblGeschlcht = new Label(container, SWT.NONE);
			lblGeschlcht.setText("Geschlächt");
		}
		{
			Composite composite = new Composite(container, SWT.NONE);
			composite.setLayout(new GridLayout(2, false));
			{
				Button btnMnnlich = new Button(composite, SWT.RADIO);
				btnMnnlich.setText("Männlich");
			}
			{
				Button btnWeiblich = new Button(composite, SWT.RADIO);
				btnWeiblich.setText("Weiblich");
			}
		}
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		{
			Label lblEinsatzort = new Label(container, SWT.NONE);
			lblEinsatzort.setText("Einsatzort");
		}
		new Label(container, SWT.NONE);
		{
			txtEinsatzort = new Text(container, SWT.BORDER);
			txtEinsatzort.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		}
		new Label(container, SWT.NONE);
		{
			Label lblZiel = new Label(container, SWT.NONE);
			lblZiel.setText("Wohingebracht");
		}
		{
			ToolBar toolBar = new ToolBar(container, SWT.FLAT | SWT.RIGHT);
			{
				ToolItem tltmZiel = new ToolItem(toolBar, SWT.DROP_DOWN);
				tltmZiel.setWidth(128);
				tltmZiel.setText("Ziel");
			}
		}
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		{
			ToolBar toolBar = new ToolBar(container, SWT.FLAT | SWT.RIGHT);
			{
				ToolItem tltmDienststelle = new ToolItem(toolBar, SWT.DROP_DOWN);
				tltmDienststelle.setText("Dienststelle");
			}
		}
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		{
			ToolBar toolBar = new ToolBar(container, SWT.FLAT | SWT.RIGHT);
			{
				ToolItem tltmNotarzt = new ToolItem(toolBar, SWT.DROP_DOWN);
				tltmNotarzt.setText("Notarzt");
			}
		}
		{
			ToolBar toolBar = new ToolBar(container, SWT.FLAT | SWT.RIGHT);
			{
				ToolItem tltmNotfallsanitter_1 = new ToolItem(toolBar, SWT.DROP_DOWN);
				tltmNotfallsanitter_1.setText("Notfallsanitäter");
			}
		}
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		{
			ToolBar toolBar = new ToolBar(container, SWT.FLAT | SWT.RIGHT);
			{
				ToolItem tltmBegleiter = new ToolItem(toolBar, SWT.DROP_DOWN);
				tltmBegleiter.addSelectionListener(new SelectionAdapter() {
					@Override
					public void widgetSelected(SelectionEvent e) {
					}
				});
				tltmBegleiter.setText("Begleiter");
			}
		}
		new Label(container, SWT.NONE);
		{
			Label lblAlarmzeit = new Label(container, SWT.NONE);
			lblAlarmzeit.setText("Alarmzeit");
		}
		new Label(container, SWT.NONE);
		{
			DateTime missionStart = new DateTime(container, SWT.BORDER | SWT.DROP_DOWN | SWT.TIME | SWT.SHORT);
		}
		new Label(container, SWT.NONE);
		{
			Label lblEndzeit = new Label(container, SWT.NONE);
			lblEndzeit.setText("Endzeit");
		}
		{
			DateTime missionEnd = new DateTime(container, SWT.BORDER | SWT.DROP_DOWN | SWT.TIME | SWT.SHORT);
		}
		new Label(container, SWT.NONE);
		{
			Label lblKilometer = new Label(container, SWT.NONE);
			lblKilometer.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
			lblKilometer.setText("Kilometer");
		}
		{
			inputKilometer = new Text(container, SWT.BORDER);
			inputKilometer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		}
		new Label(container, SWT.NONE);
		{
			Label lblArtDesEinsatzes = new Label(container, SWT.NONE);
			lblArtDesEinsatzes.setText("Art des Einsatzes");
		}
		new Label(container, SWT.NONE);
		{
			ToolBar toolBar = new ToolBar(container, SWT.FLAT | SWT.RIGHT);
			{
				ToolItem tltmEinsatzart = new ToolItem(toolBar, SWT.DROP_DOWN);
				tltmEinsatzart.setText("Einsatzart");
			}
		}
		new Label(container, SWT.NONE);
		{
			Label lblDiagnose = new Label(container, SWT.NONE);
			lblDiagnose.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
			lblDiagnose.setText("Diagnose");
		}
		{
			inputDiagnose = new Text(container, SWT.BORDER);
			inputDiagnose.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		}
		new Label(container, SWT.NONE);
		new Label(container, SWT.NONE);
		{
			ToolBar toolBar = new ToolBar(container, SWT.FLAT | SWT.RIGHT);
			{
				ToolItem tltmNaca = new ToolItem(toolBar, SWT.DROP_DOWN);
				tltmNaca.setText("NACA");
			}
		}
		new Label(container, SWT.NONE);
		{
			Label lblBemerkung = new Label(container, SWT.NONE);
			lblBemerkung.setText("Bemerkung");
		}
		new Label(container, SWT.NONE);
		{
			inputBemerkung = new Text(container, SWT.BORDER);
			inputBemerkung.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 7, 1));
		}

		createActions();
		initializeToolBar();
		initializeMenu();
	}

	/**
	 * Create the actions.
	 */
	private void createActions() {
		// Create the actions
	}

	/**
	 * Initialize the toolbar.
	 */
	private void initializeToolBar() {
		IToolBarManager toolbarManager = getViewSite().getActionBars()
				.getToolBarManager();
	}

	/**
	 * Initialize the menu.
	 */
	private void initializeMenu() {
		IMenuManager menuManager = getViewSite().getActionBars()
				.getMenuManager();
	}

	@Override
	public void setFocus() {
		// Set the focus
	}
}